# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')

    a = 10
    b = 4
    result = (a + b) if a < b else a - b
    print(result)

    print(0xF)
    print(0b101)
    print(int(0o6))

    print(8 >> 2)
    print(9 >> 2)
    print(12 >> 2)

    print(4 << 3)

    print(5 ^ 3)

    print(bin(-5))

    print(~-5)
    print(~6)
    print(~-6)

    print(5 & 2)
    print(5 | 2)

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
"""
0000 0101
0000 0010
0000 0000

0000 0101
0000 0010
0000 0111
= 7

"""

"""
 0000 0101
 0000 0011
 
 0000 0110
 = 4+2=6
 
 
 -5求二进制
 0000 0101  原码
 取反
 1111 1010  反码
 加一
 1111 1011  补码
 
 
 ~5按位取反
 先算5
 0000 0101  原码
  取反
 1111 1010  反码
 减一     补码
 1111 1001 
 取反
 1000 0110 
 -6

 
 ~ -5
 1111 1011
 取反
 0000 0100
 
 ~ 6
 0000 0110
 1111 1001
 1111 1000
 0000 0111
 1000 0111
 -7
 
 -6 二进制
 0000 0110
 1111 1001
 1111 1010
 
  ~ -6
 1111 1010
 取反
 0000 0101
 = 5
 
 
"""
